"""
调用测试用例执行的总入口，可以形成测试报告allure并打开，直接执行即可生成allure报告，
包括成功和失败的用例都可以

编辑：朱丹华
"""

import sys
import subprocess

WIN = sys.platform.startswith('win')


def main():
   """主函数"""
   steps = [
       "venv\\Script\\activate" if WIN else "source venv/bin/activate",
       "pytest --alluredir allure-results --clean-alluredir",
       "allure generate allure-results -c -o allure-report",
       "allure open allure-report"
   ]
   for step in steps:
       subprocess.run("call " + step if WIN else step, shell=True)


if __name__ == "__main__":
   main()